package com.april.feign;

import com.april.pojo.TbItem;
import com.april.pojo.TbItemCat;
import com.april.pojo.TbItemParam;
import com.april.utils.PageResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * @Author: 槐序 廿一
 * @Date: 2023-06-19
 * @Time: 15:25
 * @Description:
 */
@FeignClient(name = "item-service")
public interface ItemFeign {

    @RequestMapping("item/provider/selectTbItemAllByPage")
    PageResult selectTbItemAllByPage(@RequestParam(value = "page", required = false, defaultValue = "1") int page,
                                     @RequestParam(value = "rows", required = false, defaultValue = "10") int rows);

    @RequestMapping("itemCategory/provider/selectItemCategoryByParentId")
    List<TbItemCat> selectItemCategoryByParentId(@RequestParam(value = "id", defaultValue = "0", required = false) Long id);

    @RequestMapping("itemParam/provider/selectItemParamByItemCatId")
    TbItemParam selectItemParamByItemCatId(@RequestParam("itemCatId") Long itemCatId);

    @RequestMapping("item/provider/insertTbItem")
    int insertTbItem(@RequestBody TbItem tbItem,
                     @RequestParam(value = "desc") String desc,
                     @RequestParam(value = "itemParams") String itemParams);

    @RequestMapping("item/provider/preUpdateItem")
    Map<String, Object> preUpdateItem(@RequestParam(value = "itemId") Long itemId);

    @RequestMapping("item/provider/updateTbItem")
    int updateTbItem(@RequestBody TbItem tbItem,
                     @RequestParam(value = "desc") String desc,
                     @RequestParam(value = "itemParams") String itemParams);
}
